import java.io.PrintWriter;
import java.util.HashMap;

class DotStatement extends Statement {
	private Node var1_;
	private Node var2_;
	private String type_;
	private String content_;

	public DotStatement(Node v1, Node v2, String t, String c) {
		var1_ = v1;
		var2_ = v2;
		type_ = t;
		content_ = c;
	}

	public DotStatement(Node v1, Node v2, String t) {
		var1_ = v1;
		var2_ = v2;
		type_ = t;
	}

	public DotStatement(Node v, String t, String c) {
		var1_ = v;
		type_ = t;
		content_ = c;
	}

	public DotStatement(Node v, String t) {
		var1_ = v;
		type_ = t;
	}

	public void print(PrintWriter pw) {
		pw.println("Node name : DotStatement");
		var1_.print(pw);
		if (var2_ != null) {
			var2_.print(pw);
		}
		pw.println("Type is : " + type_);
		pw.println("Content is : " + content_);
	}

	public String translate(HashMap<String, PrintWriter> pws, String condition, SymbolTable rt,
			String parent) {
		String key = rt.getStack().get(1);
		PrintWriter pw = pws.get(key);
		printIndent(pw, rt.getLevel());
		if (type_.equals("remove")) {
			var1_.translate(pws, "remove", rt, parent);
			if (var2_ != null) {
				pw.print(".");
				var2_.translate(pws, "remove", rt, parent);
			}
			pw.print(".remove");
		} else if (type_.equals("add")) {
			var1_.translate(pws, "add", rt, parent);
			if (var2_ != null) {
				pw.print(".");
				var2_.translate(pws, "add", rt, parent);
			}
			pw.print(".add");
		} else if (type_.equals("removeAll")) {
			pw.print(".");
			var1_.translate(pws, "removeAll", rt, parent);
		}
		pw.print("(");
		if (content_ != null) {
			pw.print(content_);
		}
		pw.print(")");
		pw.print(";");
		return null;
	}
}
